Skip to content

Fix blank page in X in-app browser#21

Merged
xaelophone merged 1 commit into
mainfrom
fix/in-app-browser-storage-access
Feb 24, 2026
Merged

Fix blank page in X in-app browser#21
xaelophone merged 1 commit into
mainfrom
fix/in-app-browser-storage-access

Conversation

@xaelophone

Copy link
Copy Markdown
Collaborator

Summary

  • The previous in-app browser fix (252da93) caught errors from storage method calls (setItem/getItem), but X's in-app browser blocks the property access itselfwindow.localStorage throws SecurityError before safeStorage() even runs
  • safeStorage() now takes a type string ('local'/'session') and accesses the storage property inside its own try/catch
  • Also wraps the inline theme script's localStorage call in try/catch

Root cause

// BEFORE: localStorage evaluates as an argument → throws → module crashes
let authStorage = safeStorage(localStorage);

// AFTER: property access is inside the try/catch
let authStorage = safeStorage('local');

When the module crashes, main.jsx can't import it, createRoot().render() never runs → blank page.

Test plan

  • Reproduced blank page with Playwright by blocking window.localStorage property access
  • Verified fix: page renders fully (title, subtitle, author, body) with storage blocked
  • Build passes
  • Test on staging: open a published essay link in X's in-app browser

🤖 Generated with Claude Code

The previous fix (252da93) caught errors from storage method calls
(setItem/getItem), but X's in-app browser blocks the property access
itself — `window.localStorage` throws SecurityError before safeStorage()
runs. Move the property access inside the try/catch by accepting a type
string instead of a storage object.

Also wrap the inline theme script's localStorage call in try/catch.

Reproduced and verified with Playwright: simulating blocked storage
property access, the page goes from blank to fully rendered.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel

vercel Bot commented Feb 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hermes Building Building Preview, Comment Feb 24, 2026 10:42pm

Request Review

@xaelophone
xaelophone merged commit 3d1b123 into main Feb 24, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant